/**
 * @autor Carlos E. Agüero
 * GSyC 2008/2009
 * 
 */

package Flight;

import java.io.Serializable;
import java.util.*;


public class ArrivalFlight extends Flight implements Comparable<Object>{

	String loungeRoom;
	
	public ArrivalFlight(ArrivalFlight f) {
		super(f.departureTime,f.arrivalTime,f.flightNumber,
				f.source,f.destination,f.status);
		this.loungeRoom = f.loungeRoom;
	}
	
	public ArrivalFlight(Calendar depTime, Calendar arrTime, String number, String src,
			String dst, String st, String room){
		
		super(depTime,arrTime,number,src,dst,st);
		this.loungeRoom = room;
	}
	
	public String getLoungeRoom(){ return loungeRoom;}
	
	public String toString(){
		return flightNumber + " " + status + " " 
				+ arrivalTime.getTime() + " " + 
				source + " " + loungeRoom;
	}
	
	/*public String toString(){
		return "Arrival time: " + arrivalTime.getTime() + "\n" +
		"Source: " + source + "\n" +
		"Flight number: " + flightNumber + "\n" +
		"Lounge: " + loungeRoom + "\n" +
		"Status: " + status + "\n";
	}*/
	
	public String serialize(){
		return "arrivalType" + "\t" +
		departureTime.getTime().getYear() + "\t" +
		departureTime.getTime().getMonth() + "\t" + 
		departureTime.getTime().getDate() + "\t" + 
		departureTime.getTime().getHours() + "\t" + 
		departureTime.getTime().getMinutes() + "\t" + 
		arrivalTime.getTime().getYear() + "\t" +
		arrivalTime.getTime().getMonth() + "\t" + 
		arrivalTime.getTime().getDate() + "\t" + 
		arrivalTime.getTime().getHours() + "\t" + 
		arrivalTime.getTime().getMinutes() + "\t" +
		flightNumber + "\t" +
		source + "\t" +
		destination + "\t" +
		status + "\t" +
		loungeRoom + "\t";
	}
	
	public int compareTo(Object arg0) {
		if (getFlightNumber().equals(((Flight)arg0).getFlightNumber()))
			return 0;
		else
			return arrivalTime.getTime().compareTo(((Flight)arg0).getArrivalTime().getTime());
	}
	
}